<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 6. 将用户输入的网址全部转化成我们的官网。如www.baidu.com=>www.lagou.com-->
    <script>
        let str = prompt("请输入网址")
        let reg = /baidu/
        let str1 = str.replace(reg, "www.lagou.com")
        alert(str1)
    </script>
</body>

</html>